import { defineStore } from 'pinia'
import { ref } from 'vue'
import dayjs from 'dayjs'

export const usePlanStore = defineStore(
  'plan',
  () => {
    const recIngestion = ref(0)
    const recConsume = ref(0)
    const date = ref(dayjs().format('YYYY-MM-DD'))

    const setRecIngestion = (val: number) => {
      recIngestion.value = val
    }

    const setRecConsume = (val: number) => {
      recConsume.value = val
    }

    const setDate = (val: string) => {
      date.value = val
    }

    return {
      recIngestion,
      recConsume,
      date,
      setRecIngestion,
      setRecConsume,
      setDate,
    }
  },
  {
    persist: true,
  },
)
